/**
 * Created by jn on 2016/11/1.
 * 图片上传公用js
 */

function uploadImage(index,file) {

    var uploadFile = new FormData();
    uploadFile.append("file",file);
    $.ajax({
        type:'post',
        url:'image_upload',
        enctype: 'multipart/form-data',
        processData: false,
        contentType: false,
        data: uploadFile,
        dataType:'json',
        success:function (data) {
            console.log(data);
            if(data.retCode=="0000"){
                setImage(index,data.url);
            } else {
                alert("图片上传失败");
            }
        }
    })

}